package cate.game.play.buff.h;

import cate.game.play.base.HpCfg;
import cate.game.play.buff.BuffHandler;
import cate.game.play.config.PlayCfgArgs;
import cate.game.play.proce.action.ctx.ActionCtx;
import easy.java.dev.note.NoteClass;

@NoteClass("伤害BH")
public class 伤害BH extends BuffHandler {

	private HpCfg cfg;

	@Override
	public void parse(String code) {
		cfg = new HpCfg(new PlayCfgArgs(code));
	}

	@Override
	public void parseExt(String code) {
		cfg.merge(new HpCfg(new PlayCfgArgs(code)));
	}

	@Override
	public void onAdd(ActionCtx action) {
		double damage = cfg.settle(buff.caster, buff.owner);
		if (damage <= 0) {
			return;
		}
		buff.owner.attr.buffHurt(action, buff.caster, damage);
		buff.markInvalid(action);
	}
}
